#include "semi/logg/Logger.h"
#include "semi/InitialEvent.h"

using namespace std;
using namespace semi;
using namespace semi::conf;
using namespace semi::logg;

void testGetLogger() {

    Logger log1 = Logger::getLogger("TST");
    cout << log1.toString() << endl;

    Logger log2 = Logger::getLogger("REC001");
    cout << log2.toString() << endl;

    Logger log3 = Logger::getLogger("TSK001");
    cout << log3.toString() << endl;

    log1 = Logger::getLogger("TST.TSK001");
    cout << log1.toString() << endl;

    log2 = Logger::getLogger("REC002");
    cout << log2.toString() << endl;

    log1 = Logger::getLogger("TST.TSK001");
    cout << log1.toString() << endl;

    log2 = Logger::getLogger("REC003");
    cout << log2.toString() << endl;

    log3 = Logger::getLogger("REC");
    cout << log3.toString() << endl;
}

void testLogger() {

    Logger log1 = Logger::getLogger("TST.TSK001");
    cout << log1.toString() << endl;
    log1.debug("log1.debug test1");

    Logger log2 = Logger::getLogger("REC");
    cout << log2.toString() << endl;
    log2.debug("log2.debug NG! test1");
    log2.info("log2.info OK! test2");

    Logger log3 = Logger::getLogger("TSK001");
    cout << log3.toString() << endl;
    log3.debug("log3.debug NG! test1");
    log3.info("log3.info NG! test2");
    log3.warn("log3.warn OK! test3");

    log1 = Logger::getLogger("TST.TSK001");
    cout << log1.toString() << endl;
    log1.debug("log1.debug test2");

    log2 = Logger::getLogger("REC001");
    cout << log2.toString() << endl;
    log2.warn("log2.warn OK! test3");

}

int main() {

    // initialize
    InitialEvent::startup();

    // test
    //    testGetLogger();
    testLogger();

    return 0;
}
